Validation and verification checks


Objectives : Student should be able to -


Q1. a)  Describe what is meant by validation and verification.

 Validation : 

⇒  Validation is an automatic check performed by a program to ensure that the data entered is sensible and reasonable before it is accepted by the system.

⇒  It does not check the accuracy of data

⇒  It generates an error message when the input data is not valid, and gives an opportunity to re-enter the data.

Example :   Presence check, type check, range check, format check, . . . etc.

 Verification : 

⇒  Verification is a process performed to ensure that the data entered into a computer or transferred from one system to another exactly matches with the original data.

⇒  On data entry, verification is done either manually by visual check called Proof-reading or automatically by software called Double-entry method, where the same data is entered twice and the two copies are compared with each other.

⇒  During data transmission, verification is done automatically by software using different error detection methods.

Example :   Proof-reading, Double-entry method, Parity check, Checksum, echo check, . . . etc.

b)  Tick () one box in each row to identify if the statement is about validation, verification or both.

Statement
Validation
()
Verification
()
Both
()
Entering the data twice to check if both entries are the same.    
Automatically checking that only numeric data has been entered.    
Checking data entered into a computer system before it is stored or processed.    
Visually checking that no errors have been introduced during data entry.    

c)  Give difference between data Validation and Verification.

Data Validation
Data Verification
Validation is an automatic computer check, done while entering data into the computer against the set validation rules. Verification is done either manually by Proof-reading or by entering the same data twice and comparing the two copies by computer, using software.
It ensure that the data entered is sensible and reasonable, but does not checks its accuracy. It ensure that the data entered exactly matches the original source.
Validation is done before data is accepted and stored in computer. Verification is done after data is entered into the computer.

Q2.  Validation and verification checks are used on values that are input into a computer program.

a)  (i)  State when it is appropriate to use validation.

It is used when we need to ensure that the data entered is sensible, reasonable and consistent; accepted only if it falls within the set rules. It does not check the accuracy of data.

(ii)  State when it is appropriate to use verification.

It is used when we need to ensure that the data entered exactly matches the original source. It is done by either proof reading or double entry method.

b)  (i)  Give two examples of validation checks.

  1. Range check – to ensure that a number falls within the specified range of values.
  2. Length check – to ensure that the data isn’t too short or too long.
  3. Type check – to ensure the correct type of data like, text, number or date.
  4. Presence check – to ensure that the data has been entered into a field.
  5. Format check – to ensure that the data is in right format.
  6. Check digit – the last one digit in a code (number) is used to check that the other digits are correct.

(ii)  Give two examples of verification checks.

  1. Proof reading / screen or visual check – checking the data entered against the original source visually by someone.
  2. Double entry – entering data twice and comparing the two copies using software.

Q3.  Validation check is assigned to a data field by giving appropriate field attributes and validation rules to check its integrity.

Describe the following how the following  Validation check  works and give an example of its usage.

Validation type
How it works
Example of its usage
Presence check Checks that the data has been entered into a field. In most databases a key field cannot be left blank. (i.e. Field can not be left blank).
Type check Checks that the data entered is of an expected type, e.g. text, a number, date ... etc., Name (Text), Date of birth (Date),
Age (Number), Sex (Boolean),
Price (Currency).
Format check Checks that the data is in the right format. A Passport number is in the form L9999999, where L is any letter and 9 is any number.
Example : M5228907
Date Format check Checks that the data is in the right 'Date' format. Like "dd/mm/yyyy" or "dd.mmm.yyyy"
Example : 24/03/1968 or 24 Mar.1968
Length check Checks that the data isn't too short or too long. A Password which need to be minimum six letters long.
List check (or)
Look up table
Checks that the data is in the List or Table. List of subjects of a particular grade.
Range check Checks that a value falls within the specified range. Student’s Marks mush be -
“Between 0 and 100
Check digit The last one digit in a code (number) is used to check that the other digits are correct. Bar code readers in supermarkets use check digits to check the number read is correct and match with check digit.
Consistence (or)
Cross-field check
Checks that different fields in the same record correspond correctly. If ‘Mr’ has been entered into the title field, ‘Male’ must be entered into the gender field.
Spell check Looks up words in a dictionary. Checking the spelling for a word while typing.

Q4.  A programmer has written a routine to store the name, email address and password of a contributor to a website’s discussion group.

a)  The programmer has chosen to verify the name, email address and password.

Explain why verification was chosen and describe how the programmer would verify this data.

⇒  To ensure the accuracy of input data; make sure that they entered the data what they intended, without mistake.

⇒  The programmer could ask the contributor to type in each detail twice and then check that both values are equal. If they are not equal then the input should be rejected.

b)  The programmer has also decided to validate the email address and the password.

Describe validation checks that could be used for -

Email address

⇒  Format check - to check for @ symbol that separates the mail address and domain name / no space is allowed (white or blank).

⇒  Uniqueness check - to check and ensure that it should not match with other's email address.

⇒  Length check - to check and ensure that it should not contain more than 254 characters.

Password

⇒  Length check - to check if its length is minimum 8 characters.

⇒  Format check - to check if it contains a mixture of lower and upper-case letters, atleast one digit (0 to 9) and one special character or symbol.

⇒  Presence check - to ensure that the field should not be left empty.

Q5.  State, with reasons, which validation and verification checks you could use for the following inputs.

Telephone number

⇒  Length or Range check - validation to check if the number contains 7-digits; must be between 1000000 and 9999999.

⇒  Check digit - verification to ensure the accuracy of input data; the last one digit of the number is used to check that the other digits are correct.

Pupil's name

⇒  Length check - validation to check if the length of name is less than or equal to 30 characters.

⇒  Visual check - verification to ensure the accuracy of input data; ask the user to check the name displayed on screen and confirm that it is correct.

ID-Card number

⇒  Format check - validation to check if the input data is in appropriate format with 3 characters and 3 digits.

⇒  Double-entry - verification to ensure the accuracy of input data; ask the user to type in the number twice and then check that both the values are equal.

Q6.  Write a pseudocode algorithm using pseudocode for  range check  validation to be used on entry of marks. If the input mark is out of range between 0 and 100 (inclusive), then produce an error message and ask to re-enter the mark.

REPEAT
INPUT "Enter the student's mark - ", StudentMark

IF (StudentMark < 0 OR StudentMark > 100) THEN
OUTPUT "The student's mark should be in the range 0 to 100, please re-enter the mark"
ENDIF
UNTIL (StudentMark >= 0 AND StudentMark <= 100)

Q7.  Write an algorithm using pseudocode for  length check  validation to be used on entry of password, to check if it's length is between 8 and 12 characters inclusive. If it's length is less than 8 or above 12 characters, then it should be rejected with error message.

REPEAT
INPUT "Enter the password between 8 and 12 characters in length - ", Password

IF (LENGTH(Password) < 8 OR LENGTH(Password) > 12) THEN
OUTPUT "Invalid, your password should be between 8 and 12 characters in length. Please re-enter the mark."
ENDIF
UNTIL (LENGTH(Password) >= 8 AND LENGTH(Password) <= 12)

Q8.  Write an algorithm using pseudocode for  type check  validation to be used on entry of mark, to check if it is in whole number (data type, integer). If it is in decimal (data type, real), then it should be rejected with error message.

REPEAT
INPUT "Enter the mark in whole number - ", Mark

IF  Mark  < >  DIV(Mark, 1) THEN
OUTPUT "Invalid, mark must be in whole number. Please re-enter the mark."
ENDIF
UNTIL Mark = DIV(Mark, 1)

Q9.  Write an algorithm using pseudocode for  presence check  validation to be used on entry of student ID, to check that some data has been entered and the value has not been left blank. If it is left blank, then it should be rejected with error message.

REPEAT
INPUT "Enter the student's ID - ", StdID

IF  StdID  =  " "  THEN
OUTPUT "Sorry, student's ID cannot be left blank. Please re-enter the student's ID."
ENDIF
UNTIL  StdID  < >  " "



* * * * * * * * *
* * * * * *
* * *
*